package org.zty.test;

import java.util.List;
import org.zty.common.BaseService;
import org.zty.db.DBMgr;
import java.sql.SQLException;
import org.zty.util.ZException;
public class DocItemService extends BaseService {
	public DocItemService() {
		this.client = DBMgr.getSqlMapClient();
	}
	public void insertDocItem(DocItem docItem) throws ZException{
		try {
			this.client.insert("insertDocItem",docItem);
		} catch (SQLException e) {
			e.printStackTrace();
			throw new ZException("新增DocItem失败",e);
		} catch (Exception e) {
			e.printStackTrace();
			throw new ZException("新增DocItem失败",e);
		}
	}
	public void deleteDocDocItem(DocItem docItem) throws ZException{
		try {
			this.client.delete("deleteDocItem",docItem);
		} catch (SQLException e) {
			e.printStackTrace();
			throw new ZException("删除DocItem失败",e);
		} catch (Exception e) {
			e.printStackTrace();
			throw new ZException("删除DocItem失败",e);
		}
	}
	public void updateDocDocItem(DocItem docItem) throws ZException{
		try {
			this.client.update("updateDocItem",docItem);
		} catch (SQLException e) {
			e.printStackTrace();
			throw new ZException("修改DocItem失败",e);
		} catch (Exception e) {
			e.printStackTrace();
			throw new ZException("修改DocItem失败",e);
		}
	}
	public DocItem getDocItem(DocItem docItem) throws ZException{
		try {
			return (DocItem)this.client.queryForObject("findDocItem",docItem);
		} catch (SQLException e) {
			e.printStackTrace();
			throw new ZException("获取单DocItem失败",e);
		} catch (Exception e) {
			e.printStackTrace();
			throw new ZException("获取单DocItem失败",e);
		}
	}
	public List<DocItem> findAllDocItem(DocItem docItem) throws ZException{
		try {
			return this.client.queryForList("findDocItem",docItem);
		} catch (SQLException e) {
			e.printStackTrace();
			throw new ZException("获取所有DocItem失败",e);
		} catch (Exception e) {
			e.printStackTrace();
			throw new ZException("获取所有DocItem失败",e);
		}
	}
	public List<DocItem> findDocItemList(DocItem docItem) throws ZException{
		try {
			return this.client.queryForList("findDocItem",docItem,docItem.getSkipSize(),docItem.getPageSize());
		} catch (SQLException e) {
			e.printStackTrace();
			throw new ZException("获取DocItem列表失败",e);
		} catch (Exception e) {
			e.printStackTrace();
			throw new ZException("获取DocItem列表失败",e);
		}
	}
	public List<DocItem> findDocItemPaginationList(DocItem docItem) throws ZException{
		try {
			return this.client.queryForList("findPaginationDocItem",docItem);
		} catch (SQLException e) {
			e.printStackTrace();
			throw new ZException("获取物理分页DocItem失败",e);
		} catch (Exception e) {
			e.printStackTrace();
			throw new ZException("获取物理分页DocItem失败",e);
		}
	}
}

